const path = require('path')
const webpack = require('webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
    mode: "none",
    entry: {
        index:'./src/index.js',
        about:'./src/about.js'
    },
    output: {
        filename: '[name].bundle.js',
        // path: path.join(__dirname, 'dist'),
    },
    //配置优化功能
    optimization: {
        // 代码分割，提取功能模块，输出到一个单独的bundle
        splitChunks:{
            chunks:'all'
        }
    },
    module:{
        rules:[
            {
                test:/\.css$/,
                use:['style-loader','css-loader'],
            }
        ]
        
    },
    plugins:[
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title:'multi entrt',
            filename:'index.html',
            template:'./src/index.html',
            chunks:['index'],
        }),
        new HtmlWebpackPlugin({
            title:'multi entrt',
            filename:'about.html',
            template:'./src/about.html',
            chunks:['about']
        })

    ]
}